

/**
 * Represents a point in space.
 * @author Narendra
 * @date 15.01.2012
 */

package plotter;

import static java.lang.Math.*;

class Point3D 
{
	public double x, y, z; 
	/**
	 * Is the point undefined?(Infinite or NaN)
	 */
	public boolean undefined;
	
	public Point3D(double xx, double yy, double zz, boolean udf) 
	{
		x = xx; 
		y = yy; 
		z = zz; 
		undefined = udf;
	}
	/**
	 * Rotate about x and y axis. The rotation is composite
	 * @param xang angle about x axis
	 * @param yang angle about y axis
	 */
	public void rotate(double xang, double yang) 
	{
		
		double cx = cos(xang), sx = sin(xang);
		double cy = cos(yang), sy = sin(yang);
		
		double xx = x * cy + z * sy;
		double yy = x * sx * sy + y * cx + z * -sx * cy;
		double zz = x * -cx * sy + y * sx + z * cx * cy;
		
		x = xx; y = yy; z = zz;
	}
}
